home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / hddmenu.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  4KB  |  237 lines

  1. /* --------------------------------- hddmenu.c ------------------------------ */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* Set hdd options.
  8.  *
  9.  * We need a bit more abstraction here. The vehicle can be describd as
  10.  * having the following structures:
  11.  *
  12.  * - systems (scattered)
  13.  *    Each has a private data structure to control it and to hold its
  14.  *    status.
  15.  * - visuals (the HDD_ types)
  16.  *    Each has some parameters to control the display contents and
  17.  *    format.
  18.  * - displays (st.hdd[])
  19.  *    Each has a position and dimensions, an assigned visual (maybe more
  20.  *    than one for overlaid image?) and other info (color/mono, intensity,
  21.  *    contrast etc.)
  22.  *
  23.  * todo:
  24.  *
  25.  * Define the new HD*_*** flags.
  26. */
  27.  
  28. #include "fly.h"
  29.  
  30.  
  31. static MENU FAR    MenuHddFront[] = {
  32.     {'0', "off"},        /*  0 */
  33.     {'1', "on"},        /*  1 */
  34.     {'2', "toggle"},    /*  2 */
  35.     {'i', "instruments"},    /*  3 */
  36. {'\0', 0}};
  37.  
  38. LOCAL_FUNC int NEAR
  39. menu_hdd_front (int hdd)
  40. {
  41.     int    sel, quit;
  42.  
  43.     SetOption (0, 2);
  44.     sel = 0;
  45.     for (quit = 0; !quit;) {
  46.         sel = menu_open (MenuHddFront, 0);
  47.         switch (sel) {
  48.         case MENU_ABORTED:
  49.         case MENU_FAILED:
  50.         default:
  51.             quit = 1;
  52.             break;
  53.         case 0:
  54.         case 1:
  55.         case 2:
  56.             SetOption (0, sel);
  57.             break;
  58.         case 3:
  59.             SetOption (&st.hdd[hdd].flags, HDf_INSTRUMENTS);
  60.             break;
  61.         }
  62.         if (MENU_FAILED != sel)
  63.             menu_close ();
  64.     }
  65.  
  66.     return (0);
  67. }
  68.  
  69.  
  70. static MENU FAR    MenuHddMap[] = {
  71.     {'0', "off"},        /*  0 */
  72.     {'1', "on"},        /*  1 */
  73.     {'2', "toggle"},    /*  2 */
  74.     {'c', "compass"},    /*  3 */
  75.     {'s', " square"},    /*  4 */
  76.     {'o', " ortho"},    /*  5 */
  77. {'\0', 0}};
  78.  
  79. LOCAL_FUNC int NEAR
  80. menu_hdd_map (int hdd)
  81. {
  82.     int    sel, quit;
  83.  
  84.     SetOption (0, 2);
  85.     sel = 0;
  86.     for (quit = 0; !quit;) {
  87.         sel = menu_open (MenuHddMap, 0);
  88.         switch (sel) {
  89.         case MENU_ABORTED:
  90.         case MENU_FAILED:
  91.         default:
  92.             quit = 1;
  93.             break;
  94.         case 0:
  95.         case 1:
  96.         case 2:
  97.             SetOption (0, sel);
  98.             break;
  99.             break;
  100.         case 3:
  101.             SetOption (&st.hdd[hdd].flags, HDm_COMPASS);
  102.             break;
  103.         case 4:
  104.             SetOption (&st.hdd[hdd].flags, HDm_SQRCOMPASS);
  105.             break;
  106.         case 5:
  107.             SetOption (&st.hdd[hdd].flags, HDm_ORTCOMPASS);
  108.             break;
  109.         }
  110.         if (MENU_FAILED != sel)
  111.             menu_close ();
  112.     }
  113.  
  114.     return (0);
  115. }
  116.  
  117. static MENU FAR    MenuHddPanel[] = {
  118.     {'0', "off"},        /*  0 */
  119.     {'1', "on"},        /*  1 */
  120.     {'2', "toggle"},    /*  2 */
  121.     {'n', "nav"},        /*  3 */
  122. {'\0', 0}};
  123.  
  124. LOCAL_FUNC int NEAR
  125. menu_hdd_panel (int hdd)
  126. {
  127.     int    sel, quit;
  128.  
  129.     SetOption (0, 2);
  130.     sel = 0;
  131.     for (quit = 0; !quit;) {
  132.         sel = menu_open (MenuHddPanel, 0);
  133.         switch (sel) {
  134.         case MENU_ABORTED:
  135.         case MENU_FAILED:
  136.         default:
  137.             quit = 1;
  138.             break;
  139.         case 0:
  140.         case 1:
  141.         case 2:
  142.             SetOption (0, sel);
  143.             break;
  144.         case 3:
  145.             SetOption (&st.hdd[hdd].flags, HDP_NAV);
  146.             break;
  147.         }
  148.         if (MENU_FAILED != sel)
  149.             menu_close ();
  150.     }
  151.  
  152.     return (0);
  153. }
  154.  
  155.  
  156. static MENU FAR    MenuHddTarget[] = {
  157.     {'0', "off"},        /*  0 */
  158.     {'1', "on"},        /*  1 */
  159.     {'2', "toggle"},    /*  2 */
  160.     {'n', "vv"},        /*  3 */
  161. {'\0', 0}};
  162.  
  163. LOCAL_FUNC int NEAR
  164. menu_hdd_target (int hdd)
  165. {
  166.     int    sel, quit;
  167.  
  168.     SetOption (0, 2);
  169.     sel = 0;
  170.     for (quit = 0; !quit;) {
  171.         sel = menu_open (MenuHddTarget, 0);
  172.         switch (sel) {
  173.         case MENU_ABORTED:
  174.         case MENU_FAILED:
  175.         default:
  176.             quit = 1;
  177.             break;
  178.         case 0:
  179.         case 1:
  180.         case 2:
  181.             SetOption (0, sel);
  182.             break;
  183.         case 3:
  184.             SetOption (&st.hdd[hdd].flags, HDt_TVV);
  185.             break;
  186.         }
  187.         if (MENU_FAILED != sel)
  188.             menu_close ();
  189.     }
  190.  
  191.     return (0);
  192. }
  193.  
  194.  
  195. extern int FAR
  196. hdd_setopts (int sel)
  197. {
  198.     int    sel;
  199.  
  200.     sel = menu_view (0);
  201.  
  202.     switch (sel) {
  203.     case MENU_ABORTED:
  204.     case MENU_FAILED:
  205.         break;
  206.     case  0:        /* front  */
  207.         menu_hdd_front (sel);
  208.         break;
  209.     case  3:        /* map    */
  210.     case  4:        /* radar  */
  211.         menu_hdd_map (sel);
  212.         break;
  213.     case 12:        /* panel  */
  214.         menu_hdd_panel (sel);
  215.         break;
  216.     case  5:        /* target */
  217.     case  6:        /* pan    */
  218.         menu_hdd_target (sel);
  219.         break;
  220.     case  1:        /* none   */
  221.     case  2:        /* rear   */
  222.     case  7:        /* gaze   */
  223.     case  8:        /* chase  */
  224.     case  9:        /* follow */
  225.     case 10:        /* hud    */
  226.     case 11:        /* up-front */
  227.     case 13:        /* right  */
  228.     case 14:        /* left   */
  229.     case 15:        /* stores */
  230.     case 16:        /* mirror */
  231.         MasPrintf (50, "No options for this hdd");
  232.         break;
  233.     default:
  234.         break;
  235.     }
  236. }
  237.